#ifndef _IGRID_H_
#define _IGRID_H_
#pragma once
#include <map>
#include <utility>
#include "CCGeometry.h"

using namespace cocos2d;

class ICell;
class IGrid
{	
public:
	IGrid(CCSize size);
	virtual ~IGrid(void);

	
	ICell* GetCell(CCPoint p);
	void RemoveCell(CCPoint p);
	void ReplaceCell(CCPoint p, unsigned int cellType);
	void SwapCell(CCPoint from, CCPoint to);
	virtual bool LoadLevel() = 0;
	inline CCSize GetSize() const{
		return m_size;
	}
	bool IsDirty();
	void CleanDirty();
	virtual void RefreshDisplayLayer() = 0;

private:// private methods
	inline int CCPoint2Index(CCPoint p);
	inline void SetDirty() {m_isDirty = true;};
	

private:
	std::map<int,ICell*> m_cellVector;
	CCSize m_size;
	bool m_isDirty;


};
#endif